import libc

fn split_host(string host):(string, int)! {
    var list = host.split(':')
    if list[0] == '' {
        list[0] = '0.0.0.0'
    }

    return (list[0], list[1].to_int())
}

fn is_ipv4(string ip):bool {
    u32 in_addr = 0
    return libc.inet_pton(libc.AF_INET, ip.ref(), &in_addr as anyptr) == 1
}